﻿using System.AddIn;
using System.Windows;
using DCT.AddIn.AddInView;
using System.Xml.Linq;
using System.IO;

namespace DCT.AddIn.DeviceExplorer
{
    [AddIn("DeviceExplorer", Publisher = "ShootMooN", Version = "1.0.0.0", Description = "Sample AddIn")]
    public class DeviceExplorer : DCTExtendedFunctionAddInView
    {
        private HostObject _hostObj;
        private XElement _xmlData;
        private DeviceExplorerView _deviceExplorerView;

        public override int VisualPosition
        {
            get { return 2; }
        }

        public override FrameworkElement GetVisual()
        {
            return _deviceExplorerView;
        }

        public override void UpdateData()
        {
            _xmlData = XElement.Load(_hostObj.GetData());
            _deviceExplorerView = new DeviceExplorerView(_xmlData, _hostObj);
        }

        public override void Initialize(HostObject hostObj)
        {
            _hostObj = hostObj;
        }
    }
}
